package com.txts.road.app.event.controller;

import com.txts.road.app.event.model.query.EventMomentQuery;

import com.txts.road.app.event.model.vo.*;
import com.txts.road.app.event.model.vo.*;
import com.txts.road.app.event.service.EventService;
import com.txts.base.common.domain.ResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.txts.road.app.event.model.query.EventQuery;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 赛事活动前端控制层
 *
 * @author baoyr
 * @since 2025-07-17 10:47
 */
@Tag(name = "赛事活动接口")
@RestController
@RequestMapping("/api/v1/event")
@RequiredArgsConstructor
public class EventController {

    private final EventService eventService;

    /**
     * 获取 Banner 列表
     *
     * @return Banner 列表
     */
    @Operation(summary = "获取 Banner 列表")
    @GetMapping("/banners")
    public ResponseDTO<List<EventNewsVO>> getBannerList() {
        return ResponseDTO.ok(eventService.getBannerList());
    }


    /**
     * 获取赛事列表
     */
    @Operation(summary = "获取赛事列表")
    @PostMapping("/list")
    public ResponseDTO<List<EventVO>> getEventList(@RequestBody EventQuery queryDTO) {
        return ResponseDTO.ok(eventService.getEventList(queryDTO));
    }


    /**
     * 获取赛事详情
     */
    @Operation(summary = "获取赛事详情")
    @GetMapping("/{eventId}")
    public ResponseDTO<EventVO> getEventDetail(@PathVariable Long eventId) {
        return ResponseDTO.ok(eventService.getEventDetail(eventId));

    }


    /**
     * 获取参赛车辆实时位置
     */
    @Operation(summary = "获取参赛车辆实时位置")
    @GetMapping("/{eventId}/vehicles/realtime")
    public ResponseDTO<List<EventVehicleLocationVO>> getEventVehiclesRealtime(@PathVariable Long eventId) {
        return ResponseDTO.ok(eventService.getEventVehiclesRealtime(eventId));
    }

    /**
     * 获取赛事统计信息
     */
    @Operation(summary = "获取赛事统计信息")
    @GetMapping("/{eventId}/statistics")
    public ResponseDTO<EventRegistrationVO> getEventStatistics(@PathVariable Long eventId) {
        return ResponseDTO.ok(eventService.getEventStatistics(eventId));

    }

    /**
     * 获取活动英雄榜
     */
    @Operation(summary = "获取活动英雄榜")
    @GetMapping("/{eventId}/heroes")
    public ResponseDTO<List<EventHeroVO>> getEventHeroes(@PathVariable Long eventId) {
        return ResponseDTO.ok(eventService.getEventHeroes(eventId));

    }

    /**
     * 获取活动瞬间
     */
    @Operation(summary = "获取活动瞬间")
    @GetMapping("/{eventId}/moments")
    public ResponseDTO<List<EventMomentVO>> getEventMoments(@RequestBody EventMomentQuery query) {
        return ResponseDTO.ok(eventService.getEventMoments(query));

    }
}
